<?php
// https://blog.csdn.net/weixin_45975835/article/details/103947955
class Solution {
    public function removeElement($nums, $val) {
        $nums_len = count($nums);

        //记录非关键字
        $count = 0;
        for ($i = 0; $i <= $nums_len - 1; $i++)
        {
            if ($nums[$i] != $val)
            {
                //将非关键字赋给新的顺序表
                $nums[$count] =$nums[$i];
                $count++;
            }
        }

        //新表的长度
        return $count;
    }
}